home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
dev
/
amos
/
ldosv25d.lha
/
ldos_demo
/
examples
/
ldos
/
io-demo.AMOS
/
io-demo.amosSourceCode
Wrap
AMOS Source Code
|
1992-01-02
|
2KB
|
56 lines
'This demo is rather slow since we only load 10 bytes at the time(!)
' What it does is to open your startup-sequence, read 10 bytes, save
' the 10 read bytes to a file called "ram:ut" (that is Swedish you know!)
' It repeats this until the SIZE read is less than 10 (we recahed the end
' of the file since less bytes than requested was returned).
'
' The program then prints the position in both the files, and moves
' to the start of the written file "ram:ut" and overwrites the beginning
' with the word "HELLO!"
'
' Then the whole file "ram:ut" is loaded and printed on the screen.
'
Screen Open 1,640,256,4,Hires
Paper 0 : Clw
Extension_10_0006 1,"s:startup-sequence",0
Extension_10_0006 2,"ram:ut",1
Reserve As Work 10,10
Repeat
SIZE= Extension_10_0024(1,Start(10),10) : Rem Read 10 bytes.
T= Extension_10_0034(2,Start(10),SIZE) : Rem Save read bytes to ram:ut
If T<>SIZE
Print "Diskerror!" : Extension_10_0016 1 : Extension_10_0016 2
End
End If
Until SIZE<10 : Rem When size<10 we've read the last bytes
Print "Position in file 1"; Extension_10_0044(1,-1)
Print "Position in file 2"; Extension_10_0044(2,-1)
Print "Seeking to start of outputfile"
Print "Position in outputfile is now"; Extension_10_0044(2,0)
Print "Writing the word 'HELLO!' into start of outputfile"
Centre "Press a Key" : Wait Key : Cline : Print : Cup
A$="Hello"
Extension_10_0084 A$,Start(10) : Rem Copy this string into bank 10
T= Extension_10_0034(2,Start(10),Len(A$)) : Rem Saved the copied string
Extension_10_0016 1 : Rem IMPORTANT
Extension_10_0016 2 : Rem ALWAYS CLOSE
Extension_10_0006 1,"ram:ut",0
Erase 10
' Get size of the output file
SIZE= Extension_10_0182("ram:ut")
Reserve As Work 10,SIZE : Rem A bank with same size as our file
T= Extension_10_0024(1,Start(10),SIZE) : Rem Load the whole file
ST=Start(10)
Repeat
' Get a line
A$= Extension_10_006C(ST To Start(10)+SIZE)
' Calc next startaddress which is A$+1
ST=ST+Len(A$)+1 : Rem +1 for the linefeed
Print A$
Inc LI
If LI>20
Centre "Press a Key" : Print : Cup : Wait Key : Cline
LI=0
End If
Until ST=>Start(10)+SIZE
Extension_10_0016 1